﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.SharePoint;

namespace AgileShare.Framework.SiteProvisioning.Definitions
{
	public class ViewDefinition
	{
		/// <summary>
		/// Initializes a new instance of the <see cref="ViewDefinition" /> class.
		/// </summary>
		public ViewDefinition()
		{
			this.ViewFieldIds = new List<Guid>();
		}

		/// <summary>
		/// Initializes a new instance of the <see cref="ViewDefinition" /> class.
		/// </summary>
		/// <param name="title">The title.</param>
		/// <param name="defaultView">if set to <c>true</c> [default view].</param>
		/// <param name="viewFieldIds">The view field ids.</param>
		public ViewDefinition(string title, bool defaultView = false, params Guid[] viewFieldIds) : this(title, null, 100, defaultView, true, SPViewCollection.SPViewType.Html, viewFieldIds)
		{				
		}

		/// <summary>
		/// Initializes a new instance of the <see cref="ViewDefinition" /> class.
		/// </summary>
		/// <param name="title">The title.</param>
		/// <param name="query">The query.</param>
		/// <param name="rowLimit">The row limit.</param>
		/// <param name="defaultView">if set to <c>true</c> [default view].</param>
		/// <param name="paged">if set to <c>true</c> [paged].</param>
		/// <param name="viewType">Type of the view.</param>
		/// <param name="viewFieldIds">The view field ids.</param>
		public ViewDefinition(string title, string query, uint rowLimit, bool defaultView, bool paged, SPViewCollection.SPViewType viewType, params Guid[] viewFieldIds)
		{
			this.Title = title;
			this.Query = query;
			this.RowLimit = rowLimit;
			this.DefaultView = DefaultView;
			this.Paged = paged;
			this.ViewType = viewType;
			this.ViewFieldIds = viewFieldIds.ToList();
			this.DefaultView = defaultView;
		}

		/// <summary>
		/// Gets or sets the name of the view.
		/// </summary>
		/// <value>
		/// The name of the view.
		/// </value>
		public string Title { get; set; }

		/// <summary>
		/// Gets or sets the view field ids.
		/// </summary>
		/// <value>
		/// The view field ids.
		/// </value>
		public List<Guid> ViewFieldIds { get; set; }

		/// <summary>
		/// Gets or sets the query.
		/// </summary>
		/// <value>
		/// The query.
		/// </value>
		public string Query { get; set; }

		/// <summary>
		/// Gets or sets the row limit.
		/// </summary>
		/// <value>
		/// The row limit.
		/// </value>
		public uint RowLimit { get; set; }

		/// <summary>
		/// Gets or sets a value indicating whether [default view].
		/// </summary>
		/// <value>
		///   <c>true</c> if [default view]; otherwise, <c>false</c>.
		/// </value>
		public bool DefaultView { get; set; }

		/// <summary>
		/// Gets or sets a value indicating whether this <see cref="ViewDefinition"/> is paged.
		/// </summary>
		/// <value>
		///   <c>true</c> if paged; otherwise, <c>false</c>.
		/// </value>
		public bool Paged { get; set; }

		/// <summary>
		/// Gets or sets the type of the view.
		/// </summary>
		/// <value>
		/// The type of the view.
		/// </value>
		public SPViewCollection.SPViewType ViewType { get; set; }





	}
}
